#include "cpu/exec/template-start.h"

#define instr dec

static void do_execute () {
	int i, count = 0;
	DATA_TYPE result = op_src->val - 1;
	OPERAND_W(op_src, result);

	/* Update EFLAGS. */
	//panic("please implement me");
	cpu.OF = (result == -1);
	cpu.SF = MSB(result);
	cpu.ZF = (result == 0);
	cpu.AF = ((result & 0xf) == 0xf);
	result &= 0xff;
	for (i = 0; i < 8; i++, result >>= 1) {
		count += (result & 0x1);
	}
	cpu.PF = (count % 2 == 0);

	print_asm_template1();
}

make_instr_helper(rm)
#if DATA_BYTE == 2 || DATA_BYTE == 4
make_instr_helper(r)
#endif

#include "cpu/exec/template-end.h"
